/*--------------------------------*- C++ -*----------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  7
     \\/     M anipulation  |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      binary;
    class       volScalarField;
    location    "0/solid";
    object      T;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions      [ 0 0 0 1 0 0 0 ];

internalField   uniform 300;

boundaryField
{
    solid_left
    {
        type            fixedValue;
        value           $internalField;
    }
    solid_right
    {
        type            fixedValue;
        value           $internalField;
    }
    solid_bottom
    {
        type            fixedValue;
        value           $internalField;
    }
    frontback
    {
        type            empty;
    }
    actuator1_surface
    {
        type            codedFixedValue;
        value           uniform 300;
        Tnbr            T;
        kappaMethod     solidThermo;
        redirectType    myTemperatureDistribution;
        code            #{
                    scalar w = 0.0255, sigma = 0.003; //input values
                    scalar alpha = 1.20e-7, lambda = 0.12;

                    const vectorField& Bf = patch().Cf();
                    scalarField& Tf = *this;
                    scalar t = this->db().time().value();
                    //scalar tt = t / 0.2;

                    forAll(Bf, faceI)
                    {
                        scalar x = Bf[faceI].x();
                        Tf[faceI] = exp(-pow(x-w,2)/(2.0*pow(sigma,2)))*54.0*(1-exp(pow(120,2)*alpha*t/pow(lambda,2))*erfc(sqrt(pow(120,2)*alpha*t/pow(lambda,2)))) + 25.0*(1-exp(pow(30,2)*alpha*t/pow(lambda,2))*erfc(sqrt(pow(30,2)*alpha*t/pow(lambda,2)))) + 300.0;
                    }
                #};
        codeOptions     #{
                    -I$(WM_PROJECT_DIR)/src/finiteVolume/lnInclude \
                    -I$(WM_PROJECT_DIR)/src/meshTools/lnInclude
                #};
        codeInclude     #{
                    #include "fvCFD.H"
                    #include <cmath>
                    #include <iostream>
                #};
    }
    actuator2_surface
    {
        type            codedFixedValue;
        value           uniform 300;
        Tnbr            T;
        kappaMethod     solidThermo;
        redirectType    myTemperatureDistribution;
        code            #{
                    scalar w = 0.0255, sigma = 0.003; //input values
                    scalar alpha = 1.20e-7, lambda = 0.12;

                    const vectorField& Bf = patch().Cf();
                    scalarField& Tf = *this;
                    scalar t = this->db().time().value();
                    //scalar tt = t / 0.2;

                    forAll(Bf, faceI)
                    {
                        scalar x = Bf[faceI].x();
                        Tf[faceI] = exp(-pow(x-w,2)/(2.0*pow(sigma,2)))*54.0*(1-exp(pow(120,2)*alpha*t/pow(lambda,2))*erfc(sqrt(pow(120,2)*alpha*t/pow(lambda,2)))) + 25.0*(1-exp(pow(30,2)*alpha*t/pow(lambda,2))*erfc(sqrt(pow(30,2)*alpha*t/pow(lambda,2)))) + 300.0;
                    }
                #};
        codeOptions     #{
                    -I$(WM_PROJECT_DIR)/src/finiteVolume/lnInclude \
                    -I$(WM_PROJECT_DIR)/src/meshTools/lnInclude
                #};
        codeInclude     #{
                    #include "fvCFD.H"
                    #include <cmath>
                    #include <iostream>
                #};
    }
    solid_to_air
    {
        Tnbr            T;
        kappaMethod     solidThermo;
        qrNbr           qr;
        qr              none;
        neighbourFieldName T;
        K               Kappa;
        type            compressible::turbulentTemperatureCoupledBaffleMixed;
        value           $internalField;
    }
}

solid_to_air
{
    type            compressible::turbulentTemperatureCoupledBaffleMixed;
    value           $internalField;
    Tnbr            T;
    kappaMethod     solidThermo;
}


// ************************************************************************* //
